package com.pattern.design.Chapter_4.com.devchronicles.singleton;

public class MySingleton6 {

	private volatile MySingleton6 instance;

	private MySingleton6() {
	}

	public MySingleton6 getInstance() {
		if (instance == null) { // 1
			synchronized (MySingleton6.class) {
				if (instance == null) { // 2
					instance = new MySingleton6();
				}
			}
		}
		return instance;
	}

	public static void main(String[] args) {
		System.out.println(args);
		for (String arg : args) {
			System.out.println(arg);
		}
	}
}
